package com.greenline.push.dal.pushcenter.impl;

import java.util.List;

import com.greenline.push.dal.base.BaseDAO;
import com.greenline.push.dal.pushcenter.ThrottleDao;
import com.greenline.push.dal.pushcenter.dataobject.ThrottleDO;
import com.greenline.push.dal.query.ThrottleQuery;

public class ThrottleDAOImpl extends BaseDAO implements ThrottleDao {

	@Override
	public Long insert(ThrottleDO throttleDO) {
		return (Long) super.getSqlMapClientTemplate().insert("throttle.insert",
				throttleDO);
	}

	@Override
	public ThrottleDO getById(Long id) {
		return (ThrottleDO) super.getSqlMapClientTemplate().queryForObject(
				"throttle.find_by_id", id);
	}

	@Override
	public int update(ThrottleDO throttleDO) {
		return super.getSqlMapClientTemplate().update("throttle.update",
				throttleDO);
	}

	@Override
	public ThrottleQuery listByQuery(ThrottleQuery query) {
		return (ThrottleQuery) super.listByQuery("throttle.list_by_query",
				query);
	}

	@Override
	public int deleteById(Long id) {
		return super.getSqlMapClientTemplate().update("throttle.delete", id);
	}

    @SuppressWarnings("unchecked")
    @Override
    public List<ThrottleDO> listByExample(ThrottleDO throttleDO) {
        return getSqlMapClientTemplate().queryForList("throttle.find_by_example", throttleDO);
    }

}
